In [35]:
import pandas as pd
raw_df = pd.read_csv("Zomato Chennai Listing 2020.csv" )
raw_df.drop(['Zomato URL', 'Address'], axis=1, inplace=True)
In [2]:
raw_df.head()
Out[2]:
Name of Restaurant Location Cuisine Top Dishes Price for 2 Dining Rating Dining Rating Count Delivery Rating Delivery Rating Count Features
0 Yaa Mohaideen Briyani Pallavaram ['Biryani'] ['Bread Halwa', ' Chicken 65', ' Mutton Biryan... 500.0 4.3 1500 4.3 9306 ['Home Delivery', 'Indoor Seating']
1 Sukkubhai Biriyani Alandur ['Biryani', ' North Indian', ' Mughlai', ' Des... ['Beef Biryani', ' Beef Fry', ' Paratha', ' Pa... 1000.0 4.4 3059 4.1 39200 ['Home Delivery', 'Free Parking', 'Table booki...
2 SS Hyderabad Biryani Kodambakkam ['Biryani', ' North Indian', ' Chinese', ' Ara... ['Brinjal Curry', ' Tandoori Chicken', ' Chick... 500.0 4.3 1361 4.4 10500 ['Home Delivery', 'Indoor Seating']
3 KFC Perambur ['Burger', ' Fast Food', ' Finger Food', ' Bev... ['Zinger Burger'] 500.0 4.0 1101 4.0 11200 ['Home Delivery', 'Free Parking', 'Card Upon D...
4 Tasty Kitchen Perambur ['Chinese', ' Biryani', ' North Indian', ' Che... ['Mutton Biryani', ' Chicken Rice', ' Tomato R... 450.0 4.2 617 4.1 22400 ['Home Delivery', 'Indoor Seating']
In [3]:
raw_df.shape
Out[3]:
(12032, 10)
In [4]:
raw_df.isnull().sum()
Out[4]:
Name of Restaurant       0
Location                 0
Cuisine                  0
Top Dishes               0
Price for 2              0
Dining Rating            0
Dining Rating Count      0
Delivery Rating          0
Delivery Rating Count    0
Features                 0
dtype: int64
In [5]:
raw_df['Name of Restaurant'].value_counts()
Out[5]:
Amma Unavagam                 78
CK's Bakery                   71
Domino's Pizza                66
Lassi Shop                    58
OYALO                         51
                              ..
Nagas Biriyani & Fast Food     1
Kumbakonam Idly Kadai          1
Svar - Turyaa Chennai          1
Hotel Taste And See            1
Namma Veetu Saapadu            1
Name: Name of Restaurant, Length: 8369, dtype: int64
In [6]:
raw_df['Location'].value_counts()
Out[6]:
Porur                                       418
Velachery                                   372
Ambattur                                    334
T. Nagar                                    315
Perungudi                                   288
                                           ... 
E Hotel, Royapettah                           1
Vivira Mall, Navallur                         1
GLM Meridian Hotel, T. Nagar                  1
IBIS Hotel, Old Mahabalipuram Road (OMR)      1
The Pride Hotel, Kilpauk                      1
Name: Location, Length: 268, dtype: int64
In [7]:
raw_df['Location'].sort_values
Out[7]:
<bound method Series.sort_values of 0             Pallavaram
1                Alandur
2            Kodambakkam
3               Perambur
4               Perambur
              ...       
12027              Porur
12028           Kolathur
12029    Anna Nagar East
12030          Ramapuram
12031     Sholinganallur
Name: Location, Length: 12032, dtype: object>
In [8]:
raw_df['Location'].sort_values
Out[8]:
<bound method Series.sort_values of 0             Pallavaram
1                Alandur
2            Kodambakkam
3               Perambur
4               Perambur
              ...       
12027              Porur
12028           Kolathur
12029    Anna Nagar East
12030          Ramapuram
12031     Sholinganallur
Name: Location, Length: 12032, dtype: object>
In [9]:
raw_df.head()
Out[9]:
Name of Restaurant Location Cuisine Top Dishes Price for 2 Dining Rating Dining Rating Count Delivery Rating Delivery Rating Count Features
0 Yaa Mohaideen Briyani Pallavaram ['Biryani'] ['Bread Halwa', ' Chicken 65', ' Mutton Biryan... 500.0 4.3 1500 4.3 9306 ['Home Delivery', 'Indoor Seating']
1 Sukkubhai Biriyani Alandur ['Biryani', ' North Indian', ' Mughlai', ' Des... ['Beef Biryani', ' Beef Fry', ' Paratha', ' Pa... 1000.0 4.4 3059 4.1 39200 ['Home Delivery', 'Free Parking', 'Table booki...
2 SS Hyderabad Biryani Kodambakkam ['Biryani', ' North Indian', ' Chinese', ' Ara... ['Brinjal Curry', ' Tandoori Chicken', ' Chick... 500.0 4.3 1361 4.4 10500 ['Home Delivery', 'Indoor Seating']
3 KFC Perambur ['Burger', ' Fast Food', ' Finger Food', ' Bev... ['Zinger Burger'] 500.0 4.0 1101 4.0 11200 ['Home Delivery', 'Free Parking', 'Card Upon D...
4 Tasty Kitchen Perambur ['Chinese', ' Biryani', ' North Indian', ' Che... ['Mutton Biryani', ' Chicken Rice', ' Tomato R... 450.0 4.2 617 4.1 22400 ['Home Delivery', 'Indoor Seating']
In [10]:
raw_df.isnull().sum()
Out[10]:
Name of Restaurant       0
Location                 0
Cuisine                  0
Top Dishes               0
Price for 2              0
Dining Rating            0
Dining Rating Count      0
Delivery Rating          0
Delivery Rating Count    0
Features                 0
dtype: int64
In [11]:
raw_df[raw_df['Price for 2'].isnull()]
Out[11]:
Name of Restaurant Location Cuisine Top Dishes Price for 2 Dining Rating Dining Rating Count Delivery Rating Delivery Rating Count Features
In [12]:
raw_df['Price for 2'].sort_values
Out[12]:
<bound method Series.sort_values of 0         500.0
1        1000.0
2         500.0
3         500.0
4         450.0
          ...  
12027     350.0
12028     350.0
12029     350.0
12030     350.0
12031     350.0
Name: Price for 2, Length: 12032, dtype: float64>
In [13]:
raw_df['Cuisine'].value_counts()
Out[13]:
['South Indian']                                                                      883
['Fast Food']                                                                         295
['Bakery']                                                                            266
['South Indian', ' Chinese']                                                          233
['Biryani']                                                                           225
                                                                                     ... 
['North Indian', ' Chinese', ' Sandwich', ' Rolls']                                     1
['North Indian', ' Chinese', ' BBQ', ' Mughlai', ' Biryani', ' Seafood']                1
['North Indian', ' Chinese', ' Seafood', ' Beverages', ' Ice Cream']                    1
['Fast Food', ' Healthy Food']                                                          1
['Andhra', ' Biryani', ' Chettinad', ' Chinese', ' North Indian', ' South Indian']      1
Name: Cuisine, Length: 2423, dtype: int64
In [14]:
raw_df['Cuisine'].sort_values
Out[14]:
<bound method Series.sort_values of 0                                              ['Biryani']
1        ['Biryani', ' North Indian', ' Mughlai', ' Des...
2        ['Biryani', ' North Indian', ' Chinese', ' Ara...
3        ['Burger', ' Fast Food', ' Finger Food', ' Bev...
4        ['Chinese', ' Biryani', ' North Indian', ' Che...
                               ...                        
12027                                         ['Sandwich']
12028                                         ['Sandwich']
12029                                         ['Sandwich']
12030                                         ['Sandwich']
12031                                         ['Sandwich']
Name: Cuisine, Length: 12032, dtype: object>
In [15]:
raw_df[raw_df['Cuisine'].isnull()]
Out[15]:
Name of Restaurant Location Cuisine Top Dishes Price for 2 Dining Rating Dining Rating Count Delivery Rating Delivery Rating Count Features
In [16]:
raw_df.fillna('NA', inplace=True)
In [17]:
raw_df.isnull().sum()
Out[17]:
Name of Restaurant       0
Location                 0
Cuisine                  0
Top Dishes               0
Price for 2              0
Dining Rating            0
Dining Rating Count      0
Delivery Rating          0
Delivery Rating Count    0
Features                 0
dtype: int64
In [18]:
raw_df['Delivery Rating']
Out[18]:
0         4.3
1         4.1
2         4.4
3         4.0
4         4.1
         ... 
12027    None
12028    None
12029    None
12030    None
12031    None
Name: Delivery Rating, Length: 12032, dtype: object
In [19]:
raw_df['Delivery Rating'].value_counts()
Out[19]:
None    5851
3.9     1383
3.8      701
4.0      570
3.7      559
4.1      468
3.6      465
4.2      401
3.5      314
4.3      277
3.4      259
3.3      189
4.4      128
3.2       93
3.1       79
3.0       63
4.5       55
2.9       39
2.8       26
4.6       24
2.7       19
2.6       17
2.5        9
0.3        8
2.4        7
1.8        5
2.2        5
2.3        5
2.0        5
4.7        4
2.1        2
1.5        1
1.6        1
Name: Delivery Rating, dtype: int64
In [36]:
raw_df['Delivery Rating'].replace(to_replace=['None'], value='0', inplace= True)
In [21]:
raw_df['Delivery Rating'].value_counts()
Out[21]:
0      5851
3.9    1383
3.8     701
4.0     570
3.7     559
4.1     468
3.6     465
4.2     401
3.5     314
4.3     277
3.4     259
3.3     189
4.4     128
3.2      93
3.1      79
3.0      63
4.5      55
2.9      39
2.8      26
4.6      24
2.7      19
2.6      17
2.5       9
0.3       8
2.4       7
1.8       5
2.3       5
2.0       5
2.2       5
4.7       4
2.1       2
1.5       1
1.6       1
Name: Delivery Rating, dtype: int64
In [22]:
raw_df['Delivery Rating Count'].value_counts()
Out[22]:
Not enough Delivery Reviews    3379
Does not offer Delivery        2252
None                            220
27                               34
22                               30
                               ... 
1984                              1
784                               1
1081                              1
1038                              1
3470                              1
Name: Delivery Rating Count, Length: 2282, dtype: int64
In [37]:
raw_df['Delivery Rating Count'].replace(to_replace=['Does not offer Delivery','Not enough Delivery Reviews' , 'None'], value='0', inplace= True)
In [24]:
raw_df['Delivery Rating Count'].value_counts()
Out[24]:
0       5870
27        34
60        30
40        30
37        30
        ... 
7773       1
4575       1
608        1
2230       1
8565       1
Name: Delivery Rating Count, Length: 2279, dtype: int64
In [25]:
raw_df['Dining Rating'].value_counts()
Out[25]:
None    5351
3.6      584
3.5      553
3.7      525
3.4      500
3.3      463
3.8      460
3.2      433
3.9      379
3.1      363
2.0      354
3.0      302
4.0      288
2.9      257
4.1      221
2.8      192
4.2      142
2.7      138
4.3      105
2.6       99
2.5       71
4.4       61
2.4       46
4.5       36
2.3       32
2.2       20
4.6       17
4.7       12
2.1       10
4.9        7
4.8        4
1.9        3
1.7        2
0.3        1
1.0        1
Name: Dining Rating, dtype: int64
In [38]:
raw_df['Dining Rating'].replace(to_replace=['None'], value='0', inplace= True)
In [27]:
raw_df['Dining Rating'].value_counts()
Out[27]:
0      5351
3.6     584
3.5     553
3.7     525
3.4     500
3.3     463
3.8     460
3.2     433
3.9     379
3.1     363
2.0     354
3.0     302
4.0     288
2.9     257
4.1     221
2.8     192
4.2     142
2.7     138
4.3     105
2.6      99
2.5      71
4.4      61
2.4      46
4.5      36
2.3      32
2.2      20
4.6      17
4.7      12
2.1      10
4.9       7
4.8       4
1.9       3
1.7       2
0.3       1
1.0       1
Name: Dining Rating, dtype: int64
In [28]:
raw_df['Dining Rating Count'].value_counts()
Out[28]:
Does not offer Dining        2603
Not enough Dining Reviews    2528
4                             339
5                             271
6                             248
                             ... 
677                             1
728                             1
529                             1
689                             1
895                             1
Name: Dining Rating Count, Length: 794, dtype: int64
In [39]:
raw_df['Dining Rating Count'].replace(to_replace=['Does not offer Dining','Not enough Dining Reviews', 'None' ], value='0', inplace= True)
In [30]:
raw_df['Dining Rating Count'].value_counts()
Out[30]:
0       5371
4        339
5        271
6        248
8        180
        ... 
1094       1
623        1
901        1
1311       1
1942       1
Name: Dining Rating Count, Length: 791, dtype: int64
In [40]:
raw_df['Delivery Rating Count'] = raw_df['Delivery Rating Count'].astype('int64')
raw_df['Delivery Rating'] = raw_df['Delivery Rating'].astype('float64')
raw_df['Dining Rating Count'] = raw_df['Dining Rating Count'].astype('int64')
raw_df['Dining Rating'] = raw_df['Dining Rating'].astype('float64')
raw_df['Price for 2'] = raw_df['Price for 2'].astype('int64')
In [32]:
raw_df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 12032 entries, 0 to 12031
Data columns (total 10 columns):
Name of Restaurant       12032 non-null object
Location                 12032 non-null object
Cuisine                  12032 non-null object
Top Dishes               12032 non-null object
Price for 2              12032 non-null int64
Dining Rating            12032 non-null float64
Dining Rating Count      12032 non-null int64
Delivery Rating          12032 non-null float64
Delivery Rating Count    12032 non-null int64
Features                 12032 non-null object
dtypes: float64(2), int64(3), object(5)
memory usage: 940.1+ KB
In [42]:
raw_df.columns
Out[42]:
Index(['Name of Restaurant', 'Location', 'Cuisine', 'Top Dishes',
       'Price for 2', 'Dining Rating', 'Dining Rating Count',
       'Delivery Rating', 'Delivery Rating Count', 'Features'],
      dtype='object')
In [41]:
raw_df['Delivery Rating'] = raw_df['Delivery Rating'].fillna(raw_df['Delivery Rating '])
raw_df.drop(columns=['Delivery Rating '], inplace=True)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~\anaconda3\envs\aimlVirtualEnvironment\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
   2896             try:
-> 2897                 return self._engine.get_loc(key)
   2898             except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'Delivery Rating '

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_28732\1245973291.py in <module>
----> 1 raw_df['Delivery Rating'] = raw_df['Delivery Rating'].fillna(raw_df['Delivery Rating '])
      2 raw_df.drop(columns=['Delivery Rating '], inplace=True)

~\anaconda3\envs\aimlVirtualEnvironment\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
   2993             if self.columns.nlevels > 1:
   2994                 return self._getitem_multilevel(key)
-> 2995             indexer = self.columns.get_loc(key)
   2996             if is_integer(indexer):
   2997                 indexer = [indexer]

~\anaconda3\envs\aimlVirtualEnvironment\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
   2897                 return self._engine.get_loc(key)
   2898             except KeyError:
-> 2899                 return self._engine.get_loc(self._maybe_cast_indexer(key))
   2900         indexer = self.get_indexer([key], method=method, tolerance=tolerance)
   2901         if indexer.ndim > 1 or indexer.size > 1:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'Delivery Rating '
In [ ]:
raw_df.columns
In [ ]:
raw_df.isnull().sum()
In [ ]:
raw_df.fillna('NA', inplace=True)
In [ ]:
raw_df.info()
In [ ]:
raw_df.dtypes
In [44]:
useless_data = (
    (raw_df['Delivery Rating'] != 0.0) & (raw_df['Delivery Rating Count'] == 0)
) | (
    (raw_df['Delivery Rating'] == 0.0) & (raw_df['Delivery Rating Count'] != 0)
) | (
    (raw_df['Dining Rating'] != 0.0) & (raw_df['Dining Rating Count'] == 0)
) | (
    (raw_df['Dining Rating'] == 0.0) & (raw_df['Dining Rating Count'] != 0)
) | (
    (raw_df['Dining Rating'] == 0.0) & (raw_df['Delivery Rating Count'] == 0)
) | (
    (raw_df['Dining Rating Count'] == 0.0) & (raw_df['Delivery Rating Count'] == 0)
)
In [45]:
raw_df[useless_data]
Out[45]:
Name of Restaurant Location Cuisine Top Dishes Price for 2 Dining Rating Dining Rating Count Delivery Rating Delivery Rating Count Features
1603 Erode Amman Mess Thiruvanmiyur ['Chettinad', ' South Indian', ' Kerala', ' Ch... Invalid 600 0.0 0 0.0 0 ['Home Delivery', 'Indoor Seating', 'Table boo...
2159 The Ultimate Brownie And Chocolate Place Sholinganallur ['Bakery', ' Desserts'] Invalid 350 0.0 0 0.0 0 ['Delivery Only', 'Desserts and Bakes']
2419 Amudha Aunty's kitchen Sholinganallur ['Tamil', ' South Indian'] Invalid 250 0.0 0 0.0 0 ['Breakfast', 'Delivery Only']
2537 TN 03 CAFE Tiruvottiyur ['Sandwich', ' Fast Food', ' Ice Cream', ' Bev... Invalid 200 0.0 0 0.0 0 ['Delivery Only']
2542 Maggi Point Tambaram ['Fast Food', ' Street Food', ' Beverages'] ['Masala Maggi'] 500 0.0 0 0.0 0 ['Home Delivery', 'Indoor Seating']
... ... ... ... ... ... ... ... ... ... ...
12027 CK's Sandwiches Porur ['Sandwich'] Invalid 350 0.0 0 0.0 0 ['Breakfast', 'Delivery Only']
12028 CK's Sandwiches Kolathur ['Sandwich'] Invalid 350 0.0 0 0.0 0 ['Breakfast', 'Delivery Only']
12029 CK's Sandwiches Anna Nagar East ['Sandwich'] Invalid 350 0.0 0 0.0 0 ['Breakfast', 'Delivery Only']
12030 CK's Sandwiches Ramapuram ['Sandwich'] Invalid 350 0.0 0 0.0 0 ['Breakfast', 'Delivery Only']
12031 CK's Sandwiches Sholinganallur ['Sandwich'] Invalid 350 0.0 0 0.0 0 ['Breakfast', 'Delivery Only']

3580 rows × 10 columns

In [46]:
raw_df = raw_df[~useless_data]
In [ ]:
raw_df
In [ ]:
raw_df['Dining Rating'].value_counts() 
In [47]:
import numpy as np
# Define conditions
conditions = [
    raw_df['Dining Rating'] > 4.8,
    raw_df['Dining Rating'] > 4.0,
    raw_df['Dining Rating'] > 3.5,
    raw_df['Dining Rating'] > 3.0,
    raw_df['Dining Rating'] > 2.5,
    raw_df['Dining Rating'] <= 2.4
]

# Define corresponding category labels
categories = ['Excellent', 'Very Good', 'Good', 'Average', 'Poor', 'Very Poor']

# Apply the conditions
raw_df['DINING RATING_TYPE'] = np.select(conditions, categories,default='Very Poor')  # Default is very poor
C:\Users\mpriy\anaconda3\envs\aimlVirtualEnvironment\lib\site-packages\ipykernel_launcher.py:16: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  
In [ ]:
raw_df['DINING RATING_TYPE'].value_counts()
In [48]:
#for Cuisine Type
raw_df['Cuisine Type'] = raw_df['Features'].apply(
    lambda x: 'Dine-In' if 'Indoor' in str(x) else 'No Dine-In'
)
C:\Users\mpriy\anaconda3\envs\aimlVirtualEnvironment\lib\site-packages\ipykernel_launcher.py:3: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  This is separate from the ipykernel package so we can avoid doing imports until
In [ ]:
raw_df.head()
In [ ]:
raw_df['Location'].value_counts()
In [49]:
raw_df.duplicated()
Out[49]:
0        False
1        False
2        False
3        False
4        False
         ...  
11901    False
11914    False
11953    False
11959    False
11960    False
Length: 8452, dtype: bool
In [ ]:
raw_df[raw_df.duplicated()]
In [ ]:
raw_df
In [50]:
zomato_df = raw_df.copy()
In [ ]:
zomato_df.head()
In [ ]:
zomato_df['Cuisine Type'].value_counts()
In [51]:
# 5) How many restaurants are there for eacy cuisine type
zomato_df['Cuisine Type'].value_counts()
Out[51]:
Dine-In       6413
No Dine-In    2039
Name: Cuisine Type, dtype: int64
In [52]:
import plotly.express as px 
fig = px.histogram(zomato_df, x= 'Cuisine Type', color = 'Cuisine Type',
                  title = 'Number of Restaurants by Cusine Type', 
                   labels={'CUSINE TYPE': 'CusineType'}
                  )
fig.show()
In [53]:
#  Q2) What are the percentage of restaurants by Dining Rating Type in chennai

dining_Rating_without_0 = zomato_df[zomato_df['Dining Rating'] > 0.0]

rating_Diningtype_df = dining_Rating_without_0['DINING RATING_TYPE'].value_counts().reset_index()
rating_Diningtype_df.rename(columns={'index':"DINING RATING_TYPE", "DINING RATING_TYPE" : "Count of Restaurants" }, inplace=True )
In [ ]:
rating_Diningtype_df
In [54]:
fig = px.pie(rating_Diningtype_df, names = 'DINING RATING_TYPE', values = 'Count of Restaurants',
             color = 'DINING RATING_TYPE',
                  title = 'Percentage of Restaurants by Dining Rating Type').update_traces(
    textposition='outside', textinfo='percent+label')

fig.show()
In [ ]:
zomato_df['Cuisine'].value_counts() 
In [55]:
#  Q3) Which are the Top 10 highest rated Biryani Restaurant in Chennai
biryani_zomato_df = zomato_df[zomato_df['Cuisine'].str.contains('Biryani')]
In [56]:
biryani_zomato_df.sort_values(by='Dining Rating', ascending=False).head(10)
Out[56]:
Name of Restaurant Location Cuisine Top Dishes Price for 2 Dining Rating Dining Rating Count Delivery Rating Delivery Rating Count Features DINING RATING_TYPE Cuisine Type
199 Arabian Kebab Center Kodambakkam ['Biryani', ' North Indian', ' Kebab'] ['Shawarma', ' Chicken Grill', ' Brinjal Gravy... 400 4.6 798 0.0 0 ['Takeaway Only', 'Free Parking'] Very Good No Dine-In
116 AlMaza Anna Nagar East ['Arabian', ' Mughlai', ' North Indian', ' Bir... ['Faluda', ' Rara Gosht', ' Buttermilk', ' Naa... 1000 4.6 764 4.2 881 ['Home Delivery', 'Indoor Seating', 'Table boo... Very Good Dine-In
154 Nair Mess Triplicane ['South Indian', ' Biryani'] ['Fish Fry', ' Omelette', ' Vanjaram Fry', ' M... 200 4.5 1038 0.0 0 ['Indoor Seating'] Very Good Dine-In
8757 Yaa Mohaideen Biryani Pallavaram ['Biryani', ' Chinese', ' Tamil'] ['Mutton Biryani', ' Chicken 65', ' Chicken Bi... 600 4.5 3414 0.0 0 ['Indoor Seating', 'Table Reservation Not Requ... Very Good Dine-In
9037 Palmshore Medavakkam ['North Indian', ' Chinese', ' Arabian', ' BBQ... ['Mutton Mandi', ' Biryani', ' Brownie', ' Bbq... 1000 4.5 1942 3.8 4379 ['Home Delivery', 'Valet Parking Available', '... Very Good Dine-In
283 Shiraz Art Cafe Neelangarai ['Continental', ' Parsi', ' Biryani', ' Iranian'] ['Tea', ' Baklava Cake', ' Fish', ' Pepper Chi... 1100 4.4 700 0.0 0 ['Home Delivery', 'Wifi', 'Brunch', 'Indoor Se... Very Good Dine-In
1 Sukkubhai Biriyani Alandur ['Biryani', ' North Indian', ' Mughlai', ' Des... ['Beef Biryani', ' Beef Fry', ' Paratha', ' Pa... 1000 4.4 3059 4.1 39200 ['Home Delivery', 'Free Parking', 'Table booki... Very Good Dine-In
47 Palmshore Egmore ['North Indian', ' Chinese', ' Arabian', ' BBQ... ['Mutton Mandi', ' Fish', ' Brownie', ' Sea Fo... 1000 4.4 2162 4.0 9721 ['Home Delivery', 'Indoor Seating', 'Table boo... Very Good Dine-In
96 Urban Spatula Anna Nagar West ['Continental', ' Seafood', ' Biryani', ' Ital... ['Burgers', ' Pasta', ' Fish', ' Fries', ' Chi... 800 4.4 794 4.3 911 ['Home Delivery', 'Free Parking', 'Table booki... Very Good Dine-In
9038 Palmshore Ramapuram ['North Indian', ' Chinese', ' Arabian', ' BBQ... ['Fish', ' Brownie', ' Faluda', ' Murgh Platte... 1000 4.4 4805 4.1 17300 ['Home Delivery', 'Valet Parking Available', '... Very Good Dine-In
In [ ]:
# Q4) Which is the best Carry out in Chennai
zomato_df['Cuisine Type'].value_counts() 
In [57]:
notDineIn_zomato_df = zomato_df[zomato_df['Cuisine Type'] == 'No Dine-In']
In [58]:
notDineIn_zomato_df.sort_values(by= 'Delivery Rating', ascending=False).head(2)
#4.7 Delivery Rating place
Out[58]:
Name of Restaurant Location Cuisine Top Dishes Price for 2 Dining Rating Dining Rating Count Delivery Rating Delivery Rating Count Features DINING RATING_TYPE Cuisine Type
3301 Mo Thickshake And Snackers Vadapalani ['Beverages'] Invalid 300 0.0 0 4.7 590 ['Home Delivery'] Very Poor No Dine-In
10289 The Table Porur ['Bakery', ' Desserts'] Invalid 300 0.0 0 4.6 104 ['Home Delivery', 'Pre-Ordering Required', 'De... Very Poor No Dine-In
In [59]:
#Q5) Which places have the highest rated restaurant for each Cuisine Type in Chennai?
highest_Delivery_rated_df = zomato_df[zomato_df['Delivery Rating'] >= 4.6]
In [ ]:
highest_Delivery_rated_df
In [60]:
highest_Dining_rated_df = zomato_df[zomato_df['Dining Rating'] >= 4.6]
In [ ]:
highest_Dining_rated_df
In [61]:
combined_df = pd.concat([highest_Delivery_rated_df, highest_Dining_rated_df]).drop_duplicates()
fig = px.histogram(combined_df, x = 'Location', color = 'Cuisine Type', title = 'No. of restarants with rating => 4.6 by each places'
                  ) 
fig.update_xaxes(categoryorder="total descending")
fig.update_layout(height=800, 
                  barmode='stack',  # Ensures all colors stack properly
                  legend_title_text='Cuisine Type')
 
fig.update_layout(legend_traceorder="normal") 

fig.show()
In [62]:
#  Q6) What is the Avg Price Distibution of highest rated restaurant for each Cuisine Type in Chennai?
combined_df
highest_rated_price_df = combined_df.groupby(by = ['Location', 'Cuisine Type'])['Price for 2'].mean().reset_index()
In [ ]:
highest_rated_price_df.head()
In [63]:
fig = px.scatter(highest_rated_price_df, x='Location', y='Price for 2', color = 'Cuisine Type', symbol = 'Cuisine Type',
                title = 'Avg price Distribution of Highly rated restaurants for each cusine types '
                ).update_traces(marker_size = 10)
fig.update_xaxes(categoryorder="total descending")
fig.update_layout(height=800, 
                  barmode='stack',  # Ensures all colors stack properly
                  legend_title_text='Cuisine Type')
 
fig.update_layout(legend_traceorder="normal") 

fig.show() 
In [64]:
# Q7) Which areas have a large number of Chinese Restaurant Market?
chinese_df = zomato_df[zomato_df['Cuisine'].str.contains('Chinese')]
chinese_df
Out[64]:
Name of Restaurant Location Cuisine Top Dishes Price for 2 Dining Rating Dining Rating Count Delivery Rating Delivery Rating Count Features DINING RATING_TYPE Cuisine Type
2 SS Hyderabad Biryani Kodambakkam ['Biryani', ' North Indian', ' Chinese', ' Ara... ['Brinjal Curry', ' Tandoori Chicken', ' Chick... 500 4.3 1361 4.4 10500 ['Home Delivery', 'Indoor Seating'] Very Good Dine-In
4 Tasty Kitchen Perambur ['Chinese', ' Biryani', ' North Indian', ' Che... ['Mutton Biryani', ' Chicken Rice', ' Tomato R... 450 4.2 617 4.1 22400 ['Home Delivery', 'Indoor Seating'] Very Good Dine-In
5 Dine N Fun Medavakkam ['South Indian', ' North Indian', ' Chinese'] ['Chicken Grill', ' Shawarma', ' Naan', ' Chic... 450 4.1 567 3.8 24700 ['Home Delivery', 'Indoor Seating'] Very Good Dine-In
8 Savoury Sea Shell Anna Nagar East ['Arabian', ' Chinese', ' North Indian', ' Leb... ['Shawarma', ' Chicken Grill', ' Brownie', ' S... 1400 4.2 2564 4.1 21700 ['Home Delivery', 'Indoor Seating', 'Card Upon... Very Good Dine-In
9 Sangeetha Veg Restaurant T. Nagar ['South Indian', ' North Indian', ' Chinese', ... ['Filtered Coffee', ' Chaat', ' Faluda', ' Mas... 800 4.4 1578 4.2 39600 ['Breakfast', 'Home Delivery', 'Vegetarian Onl... Very Good Dine-In
... ... ... ... ... ... ... ... ... ... ... ... ...
11883 Hotel Rahman Chengalpattu ['Biryani', ' Chinese', ' Arabian'] Invalid 300 0.0 0 3.4 127 ['Home Delivery', 'Indoor Seating'] Very Poor Dine-In
11886 Hotel Rahman Medavakkam ['Biryani', ' Chinese', ' Arabian'] Invalid 300 0.0 0 3.9 101 ['Home Delivery', 'Indoor Seating'] Very Poor Dine-In
11887 Hotel Rahman Old Mahabalipuram Road (OMR) ['Biryani', ' Chinese', ' Arabian'] Invalid 300 0.0 0 3.2 26 ['Home Delivery', 'Indoor Seating'] Very Poor Dine-In
11959 The Shangai Story Madipakkam ['Chinese'] Invalid 350 0.0 0 2.9 17 ['Delivery Only'] Very Poor No Dine-In
11960 The Shangai Story Egatoor ['Chinese'] Invalid 350 0.0 0 2.7 17 ['Delivery Only'] Very Poor No Dine-In

2749 rows × 12 columns

In [65]:
chinese_rest_df = chinese_df.groupby(by='Location').agg({'Name of Restaurant': 'count', 'Price for 2': 'mean'}
                                                     ).rename(columns={'Name of Restaurant': 'COUNT of Restaurants'}).reset_index()

chinese_rest_df = chinese_rest_df.sort_values('COUNT of Restaurants', ascending=False).head(25)
chinese_rest_df.head()
Out[65]:
Location COUNT of Restaurants Price for 2
139 Porur 92 445.108696
7 Ambattur 82 395.731707
165 T. Nagar 78 507.051282
195 Velachery 78 533.333333
134 Perambur 76 434.210526
In [66]:
fig = px.bar(chinese_rest_df, x='Location', y='COUNT of Restaurants',
             color='Price for 2', title= 'No. of Chinese Restaurant by places') 
 
fig.show() 
In [67]:
#Q8) Is there a relation between Price and Rating by each Cuisine Type?
price_rating_df = zomato_df.groupby(['Cuisine Type', 'DINING RATING_TYPE'])['Price for 2'].mean().reset_index()
price_rating_df
Out[67]:
Cuisine Type DINING RATING_TYPE Price for 2
0 Dine-In Average 397.640977
1 Dine-In Excellent 650.000000
2 Dine-In Good 490.762506
3 Dine-In Poor 441.774892
4 Dine-In Very Good 951.690141
5 Dine-In Very Poor 379.876374
6 No Dine-In Average 275.480226
7 No Dine-In Excellent 200.000000
8 No Dine-In Good 320.621469
9 No Dine-In Poor 330.983607
10 No Dine-In Very Good 1201.785714
11 No Dine-In Very Poor 329.423197
In [68]:
fig = px.line(price_rating_df, y= 'Price for 2', x='DINING RATING_TYPE', color = 'Cuisine Type')
fig.show()
In [69]:
#  Q9) Is there a relation between Location and Price
region_price_df = zomato_df.groupby(['Location'])['Price for 2'].mean().reset_index()
region_price_df
Out[69]:
Location Price for 2
0 InterContinental Chennai Mahabalipuram Resort... 1500.000000
1 Abhiramapuram 230.000000
2 Abu Sarovar Portico, Egmore 1000.000000
3 Adambakkam 308.750000
4 Adyar 476.562500
... ... ...
259 Vivira Mall, Navallur 500.000000
260 Washermenpet 340.909091
261 WelcomHotel, RK Salai (Cathedral Road) 2075.000000
262 West Mambalam 273.673469
263 Zone by The Park, Pallikaranai 1633.333333

264 rows × 2 columns

In [70]:
fig = px.scatter(region_price_df, x='Location', y='Price for 2').update_traces(marker_size =8) 
fig.update_layout(height=800)
fig.show()
In [71]:
# Q10) Find the list of Affordable Restaurants
affordable_price=zomato_df['Price for 2'].max()/4
In [ ]:
affordable_price
In [72]:
affordable_rest_df = zomato_df[zomato_df['Price for 2']<1250.0]
In [73]:
affordable_rest_df.sort_values(by= 'Price for 2', inplace=True)
C:\Users\mpriy\anaconda3\envs\aimlVirtualEnvironment\lib\site-packages\ipykernel_launcher.py:1: SettingWithCopyWarning:


A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy

In [74]:
affordable_rest_df_above_4_5_rating = affordable_rest_df[affordable_rest_df['Dining Rating']>= 4.5]
In [ ]:
affordable_rest_df_above_4_5_rating
In [75]:
# Q10) Find the list of most Reliable Restaurants
mean_votes = zomato_df['Dining Rating Count'].mean() 
mean_votes  
Out[75]:
106.99739706578325
In [77]:
mean_rest_df = zomato_df[['Name of Restaurant', 'Price for 2', 'Cuisine', 'Location', 'Cuisine Type', 'Dining Rating Count']] 
mean_rest_df = mean_rest_df[mean_rest_df['Dining Rating Count'] > 106] 
mean_rest_df.sort_values(by='Dining Rating Count', inplace=True) 
mean_rest_df = mean_rest_df[mean_rest_df['Price for 2']<  (zomato_df['Price for 2'].max()/4) ]
In [78]:
mean_rest_df
Out[78]:
Name of Restaurant Price for 2 Cuisine Location Cuisine Type Dining Rating Count
1136 Cream World 350 ['Ice Cream', ' Desserts', ' Fast Food'] Ashok Nagar Dine-In 107
1641 Sri Ganesh Bhavan 300 ['South Indian', ' Chinese'] Selaiyur Dine-In 107
9057 A2B - Adyar Ananda Bhavan 300 ['Mithai', ' Street Food', ' Fast Food', ' Ice... Mahabalipuram Dine-In 107
10007 Street Kitchen 600 ['Chinese', ' North Indian', ' BBQ', ' Rolls',... Kolathur Dine-In 107
990 Masaledaar Urban Rasoi 400 ['North Indian'] Perungudi Dine-In 107
... ... ... ... ... ... ...
9040 Palmshore 1000 ['North Indian', ' Chinese', ' Arabian', ' BBQ... Ashok Nagar Dine-In 4478
9038 Palmshore 1000 ['North Indian', ' Chinese', ' Arabian', ' BBQ... Ramapuram Dine-In 4805
9026 Copper Kitchen 1000 ['North Indian', ' Chinese', ' Chettinad', ' S... Porur Dine-In 5073
9030 Paradise Biryani 800 ['Biryani', ' North Indian', ' Chinese'] Perungudi Dine-In 5317
74 Onesta 600 ['Pizza', ' Italian', ' Fast Food', ' Beverage... Semmancheri Dine-In 5407

1624 rows × 6 columns

In [ ]: